<!DOCTYPE html>
<html lang="<?php echo Yii::app()->language; ?>">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/font-awesome.min.css" rel="stylesheet" />
<!--[if IE 7]>
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/font-awesome-ie7.min.css" rel="stylesheet" />
<![endif]-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300|Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css' />
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
<link href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/ace.min.css" rel="stylesheet" />
<link href='<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/ace-responsive.min.css' rel='stylesheet' />
<!--[if lt IE 9]>
<link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl; ?>/assets/css/ace-ie.min.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl; ?>/css/customized.css?v=<?php echo Yii::app()->params['version']; ?>" />
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- The fav icon -->
<link rel="shortcut icon" href="<?php echo Yii::app()->baseUrl; ?>/img/favicon.ico">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<title><?php echo CHtml::encode($this->pageTitle) . ' - ' . Yii::app()->name; ?></title>
</head>

<body>
<div id="message_tips" style="max-height:600px;overflow:auto;"></div>
<!-- nav bar starts -->
<div class="navbar navbar-inverse">
	<div class="navbar-inner">
		<div class="container-fluid">
			<a class="brand" href="#">
				<h4><i class="icon-desktop"></i> Yamii Offer Collector</h4>
			</a><!--/.brand-->
			<ul class="nav ace-nav pull-right">
<!-- user dropdown starts -->
<li class="light-blue user-profile">
	<a class="user-menu dropdown-toggle" href="#" data-toggle="dropdown" style="padding:0 15px;">
<?php if (!Yii::app()->user->isGuest) { ?>
		<img src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/avatars/profile-pic.jpg" class="nav-user-photo" />
		<span class="user-info">
			<small><?php echo BUtils::T('welcome_lbl'); ?>,</small>
			<?php echo Yii::app()->user->name; ?>
		</span>
<?php } else { ?>
		<img src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/avatars/profile-pic.jpg" class="nav-user-photo" />
		<span class="user-info">
			<small><?php echo BUtils::T('welcome_lbl'); ?>,</small>
			<?php echo Yii::app()->user->name; ?>
		</span>
<?php } ?>
		<i class="icon-caret-down"></i>
	</a>
	<ul class="dropdown-menu">
		<li><a href="<?php echo Yii::app()->createUrl('/site/language', array('lang' => 'en_GB')); ?>"><i class="icon-check-empty"></i> English</a></li>
		<li><a href="<?php echo Yii::app()->createUrl('/site/language', array('lang' => 'fi_FI')); ?>"><i class="icon-check-empty"></i> Suomi</a></li>
		<li><a href="<?php echo Yii::app()->createUrl('/site/language', array('lang' => 'zh_CN')); ?>"><i class="icon-check-empty"></i> 简体中文</a></li>
		<li class="divider"></li>
		<li><a href="<?php echo Yii::app()->createUrl('/tools/default/logout'); ?>"><i class="icon-signout"></i> <?php echo BUtils::T('logout_lbl'); ?></a></li>
	</ul>
</li>
<!-- user dropdown ends -->
				<li class="grey" style="display:none">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding:0 5px;">
						<i class="icon-globe icon-only"></i><i class="icon-caret-down"></i>
					</a>
					<ul class="dropdown-menu">
					</ul>
				</li>
			</ul>
			
		</div><!--/.container-fluid-->
	</div><!--/.navbar-inner-->
</div>

<div class="main-container container-fluid">
	<a class="menu-toggler" id="menu-toggler" href="#">
		<span class="menu-text"></span>
	</a>
	
	<div class="sidebar" id="sidebar">
		<div class="sidebar-shortcuts" id="sidebar-shortcuts">
			<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
				<a class="btn btn-small btn-info" href="<?php echo Yii::app()->createUrl('/tools/merchant') ?>" title="<?php echo Yii::t('app', 'merchants.lbl'); ?>">
					<i class="icon-list"></i>
				</a>
				<a class="btn btn-small btn-success" href="<?php echo Yii::app()->createUrl('/tools/merchant/form') ?>" title="Create new merchant">
					<i class="icon-edit"></i>
				</a>
				<a class="btn btn-small btn-warning" href="<?php echo Yii::app()->createUrl('/tools/offer') ?>" title="<?php echo BUtils::T('offers_lbl'); ?>">
					<i class="icon-certificate"></i>
				</a>
				<a class="btn btn-small" href="<?php echo Yii::app()->createUrl('/tools/default/logout') ?>" title="<?php echo BUtils::T('logout_lbl'); ?>">
					<i class="icon-signout"></i>
				</a>
			</div>
			<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
				<a class="btn btn-info" href="<?php echo Yii::app()->createUrl('/tools/merchant') ?>"></a>
				<a class="btn btn-success" href="<?php echo Yii::app()->createUrl('/tools/merchant/form') ?>"></a>
				<a class="btn btn-primary" href="<?php echo Yii::app()->createUrl('/tools/offer') ?>"></a>
				<a class="btn btn-warning" href="<?php echo Yii::app()->createUrl('/tools/default/logout') ?>"></a>
			</div>
		</div><!--#sidebar-shortcuts-->

		<ul class="nav nav-list">
			<li class="<?php echo ($this->id=='merchant') ? 'active' : ''; ?>">
				<a class="dropdown-toggle" href="#">
					<i class="icon-list"></i>
					<span class="menu-text"><?php echo Yii::t('app', 'merchants.lbl'); ?></span>
					<b class="arrow icon-angle-down"></b>
				</a>
				<ul class="submenu" style="<?php echo ($this->id=='merchant') ? '' : 'display:none;'; ?>">
					<li class="<?php echo ($this->id=='merchant' and $this->action->id=='index') ? 'active' : ''; ?>">
						<a href="<?php echo Yii::app()->createUrl('/tools/merchant') ?>">
							<i class="icon-double-angle-right"></i>
							Merchant List
						</a>
					</li>
					<li class="<?php echo ($this->id=='merchant' and $this->action->id=='form') ? 'active' : ''; ?>">
						<a href="<?php echo Yii::app()->createUrl('/tools/merchant/form') ?>">
							<i class="icon-double-angle-right"></i>
							Create new merchant
						</a>
					</li>
				</ul>
			</li>
			<li class="<?php echo ($this->id=='offer') ? 'active' : ''; ?>">
				<a href="<?php echo Yii::app()->createUrl('/tools/offer') ?>">
					<i class="icon-certificate"></i>
					<span class="menu-text"><?php echo BUtils::T('offers_lbl'); ?></span>
				</a>
			</li>
		</ul><!--/.nav-list-->
		<div class="sidebar-collapse" id="sidebar-collapse">
			<i class="icon-double-angle-left"></i>
		</div>
	</div>
	
	<div class="main-content">
		<?php if(isset($this->breadcrumbs)):?>
		<div class="breadcrumbs" id="breadcrumbs">
			<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
				'links' => $this->breadcrumbs,
				'htmlOptions' => array('class' => 'breadcrumb'),
				'homeLink' => CHtml::link('Tools', array('/tools')),
			)); ?>
		</div>
		<?php endif ?>
		
		<div class="page-content">
			<?php echo $content; ?>
		</div>
	</div>
</div>
	
<div style="position:relative;">
<?php if (YII_DEBUG) { ?>
<b onclick="ajax_debug('<?php echo Yii::app()->createUrl('/ajax/debug', array('do' => 'show')); ?>')"></b>
<div id="debug-enable" style="position:fixed; bottom:30px; left:30px;">
    <button class="btn little" onclick="ajax_debug('<?php echo Yii::app()->createUrl('ajax/debug', array('do' => 'show')); ?>');">Debug Session</button>
    <button class="btn little" onclick="ajax_debug('<?php echo Yii::app()->createUrl('ajax/debug', array('do' => 'clear')); ?>');">Clear Session</button>
</div>
<script type="text/javascript">
function ajax_debug(url) {
    $.get(url, function(data) {
        $('#message_tips').html(data).slideDown();
        $('#message_tips').click(function(){ $(this).slideUp(); });
    });
}
</script>
<?php } ?>
</div>
<!--basic scripts-->
<script type="text/javascript">
if("ontouchend" in document) document.write("<script src='<?php echo Yii::app()->theme->baseUrl; ?>/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!--[if lte IE 8]>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/js/excanvas.min.js"></script>
<![endif]-->
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/js/bootstrap.min.js"></script>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/js/jquery.ui.touch-punch.min.js"></script>
<!-- customized libs -->
<?php BHelper::HtmlScripts(); ?>
</body>
</html>